"use strict";
cc._RFpush(module, '8283dwf6SpG8oDzd3v0EdbZ', 'SurfaceEffctor');
// Box2D\Scripts\Effector\SurfaceEffctor.js

var body;

cc.Class({
    'extends': cc.Component,

    editor: {
        requireComponent: Body
    },

    properties: {
        speed: 0
    },

    onLoad: function onLoad() {
        body = this.getComponent('Body');
        var callback = new CallbackEvent();
        callback.target = this;
        callback.componentName = this.__classname__;
        callback.functionName = 'onTargetEnter';
        body.onPreSolve = callback;
    },

    onTargetEnter: function onTargetEnter(contact) {
        var targetBody = contact.targetBody;
        var angle = this.node.convertToWorldRotation();
        var radian = angle / 360 * 2 * Math.PI;
        var force = cc.pRotateByAngle(new cc.Vec2(1, 0), cc.Vec2.ZERO, -radian);
        force.x *= this.speed;
        force.y *= this.speed;
        targetBody.addForce(force);
    }
});

cc._RFpop();